package com.speciality.demo.demos.web;

import com.speciality.demo.demos.dto.DailyChartVO;
import com.speciality.demo.demos.service.WeatherDailyChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("/api/weather/daily")
public class WeatherDailyChartController {
    @Autowired
    private WeatherDailyChartService dailyChartService;

    @GetMapping
    public DailyChartVO getDailyChart(
            @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
            @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate
    ) {
        return dailyChartService.getDailyChartData(startDate, endDate);
    }
}
